﻿<?php
include_once('common/header.php');	
if($AppUI->id <= 0 || !isset($_SERVER['HTTP_REFERER'])) {
	$this->_redirect(HOST_VFRIEND);
}
$strToken	= $objRequest->getParam('token', '');
$strSession	= Vfriend_Function::getSecret($AppUI->id, SE_ACCOUNT_AVATAR_DEL);
if($strSession != '' && $strToken != '' && $strSession == $strToken && Vfriend_Function::isValidLink($_SERVER['HTTP_REFERER'])) {
	Vfriend_Function::deleteSecret($AppUI->id, SE_ACCOUNT_AVATAR_DEL);
	$objPhoto		= new Photo();
	$objVfriendUser	= new Vfriend_User();
	$objUser		= $objVfriendUser->getFull($AppUI->id);
	$intError		= $objPhoto->delete($AppUI->id,$objUser->imageid);
	if($intError == 0) {
		Vfriend_Function::setMsg($arrMessage[20]);
	} else {
		Vfriend_Function::setError($arrError[49]);
	}
} else {
	Vfriend_Function::setError($arrError[48]);
}
Vfriend_Function::redirect(LINK_ACCOUNT_BASIC);
exit();
?>